﻿using System.Data.Entity.ModelConfiguration;
using System.ComponentModel.DataAnnotations;

using Whoever.Health.Business.Entities;

namespace Whoever.Health.DataAccess.Configuration
{
    internal class ContactConfiguration : EntityTypeConfiguration<Contact>
    {
        public ContactConfiguration()
        {
            HasKey(e => e.Id);

            Property(e => e.Id)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);

            Property(e => e.Name)
                .IsUnicode(false)
                .HasMaxLength(60);

            Property(e => e.Surname)
                .IsUnicode(false)
                .HasMaxLength(60);

            Property(e => e.Description)
                .IsUnicode(false)
                .IsMaxLength();

            Property(e => e.WebsiteURL)
                .IsUnicode(false)
                .HasMaxLength(60);

            Property(e => e.CompanyName)
                .IsUnicode(false)
                .HasMaxLength(60);

            HasRequired(e => e.Type)
                .WithRequiredPrincipal();

            HasRequired(e => e.Status)
                .WithRequiredPrincipal();

            ToTable("Contact", "dbo");
        }
    }
}
